<?php

class Exam extends IController
{
    public function regis()
    {
        $this->redirect('regis');
    }

    public function act()
    {
        $id=$_GET['id'];
        $id=base64_decode($id);
        $arr=array('status'=>1);
        $model=new IModel('examt');
        $model->setData($arr);
        $res=$model->update("id=$id");
        if($res)
        {
            $this->redirect('login');
        }
    }

    public function register()
    {
        $name=IReq::get("name");
        $pwd=IReq::get("pwd");
        $email=IReq::get("email");
        $arr=array("name"=>$name,'pwd'=>$pwd,'email'=>$email,'status'=>0);
        $model=new Imodel('examt');
        $model->setData($arr);
        $res=$model->add();
        if($arr){
            $title="欢迎注册";
            $url="http://localhost/three/rikao119/exam/act/id/".base64_encode($res);
            $content="点此链接激活！".$url;
            $mail=new SendMail();
            $mail->send($email.$title,$content);
        }
    }
}